package com.demo.controller;

import com.demo.pojo.ChatMessage;
import com.demo.pojo.ResultVO;
import com.demo.service.ChatMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/chatMessage")
public class ChatMessageController {
    @Autowired
    private ChatMessageService chatMessageService;
    /**
     * 发送消息
     * @param chatMessage
     * @return
     */
    @PostMapping("/send")
    public ResultVO send(@RequestBody ChatMessage chatMessage){
        return chatMessageService.send(chatMessage);
    }
    /**
     * 获取消息
     * @param id 查看的用户id
     * @return
     */
    @GetMapping("/get")
    public ResultVO<List<ChatMessage>> get(@RequestParam Long id){
        return chatMessageService.get(id);
    }
    /**
     *
     */

}
